package com.zzyl.mapper;

import com.github.pagehelper.Page;
import com.zzyl.entity.Role;
import com.zzyl.vo.RoleVo;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface RoleMapper {
    void insert(Role role);

    Page<RoleVo> page(String roleName);

    @Select("select distinct resource_no from sys_role_resource where role_id = #{roleId}")
    List<String> findCheckedResources(Long roleId);
    
    @Select("select * from sys_role where id = #{id}")
    Role selectById(Long id);

    void update(Role role);

    @Delete("delete from sys_role where id = #{roleId}")
    void deleteById(Long roleId);

    @Select("select  * from sys_role")
    List<RoleVo> getAllRole();
}
